package com.example.whitelist.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.example.whitelist.aop.DoJoinPoint;

@Configuration
@ConditionalOnClass(WhiteListProperties.class)
@EnableConfigurationProperties(WhiteListProperties.class)
public class WhiteListAutoConfigure {
	
	@Bean("whiteListConfig")
	@ConditionalOnMissingBean
	public String whiteListConfig(WhiteListProperties properties) {
		return properties.getUsers();
	}
	
	@Bean
	public DoJoinPoint doJoinPoint() {
		return new DoJoinPoint();
	}
	
}
